package com.hmall.user.holder;

/**
 * @Author: ahcfl
 * @Date: 2021年07月31日 0:19
 * @Description:
 */
public class UserIdHolder {
    public static ThreadLocal<Long> tl = new ThreadLocal<>();

    // 将资源放入到线程容器
    public static void saveUserId(Long userId) {
        tl.set(userId);
    }

    public static void removeUserId() {
        tl.remove();
    }

    public static Long getUserId() {
        return tl.get();
    }
}
